from wtforms.validators import Email


def get_admin_login_form():
    """
    获得登录表单
    :return:
    """
    from flask_wtf import FlaskForm
    from wtforms import StringField, PasswordField, SubmitField
    from wtforms.validators import DataRequired, EqualTo, Length

    class Login(FlaskForm):
        email = StringField(label='邮箱', validators=[DataRequired(), Email()],
                            render_kw={
                                'value': '',
                                "class": "form-control"
                            }
                            )

        password = PasswordField(label='密码',
                                 validators=[DataRequired(), Length(3, 8, '密码长度必须在3-8之间')],
                                 render_kw={
                                     'value': '',
                                     "class": "form-control"
                                 }
                                 )
        submit = SubmitField(render_kw={
            'value': '登 录',
            "class": "form-control"
        })

    return Login()
